import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class MaxsalarySortMapper extends Mapper<LongWritable, Text, MaxsalarySortFlowbean,Text> {
    Text v=new Text();
    MaxsalarySortFlowbean k=new MaxsalarySortFlowbean();
    protected void map(LongWritable key, Text value,Mapper<LongWritable,Text, MaxsalarySortFlowbean,Text>.Context context)
            throws IOException, InterruptedException {
        //1.获取一行
        String line =value.toString();
        //2.切割
        String[] fields=line.split("\t");
        //3.封装
        String jd_sub_type=fields[1];//招聘岗位类型
        long max_salary=Long.parseLong(fields[6]);//最高工资
        String min_edu_level=fields[13];//最低学历水平

        k.setMax_salary(max_salary);
        k.setMin_edu_level(min_edu_level);
        k.setJd_sub_type(jd_sub_type);

        v.set(jd_sub_type);
        //4.写出
        context.write(k,v);

    }
}
